package com.xmut.mall.auth.controller;

import com.auth0.jwt.JWT;
import com.xmut.mall.auth.annotation.CheckJwt;
import com.xmut.mall.auth.feign.MemberFeignService;
import com.xmut.mall.auth.service.AuthService;
import com.xmut.mall.auth.utils.RespBean;
import com.xmut.mall.auth.vo.JwtAuthCheckVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AuthController {

    @Autowired
    private AuthService authService;

    @Autowired
    private MemberFeignService memberFeignService;

    /**
     * 校验jwt权限
     * @param vo
     * @return
     */
    @PostMapping("/JwtAuthCheck")
    public RespBean JwtAuthCheck(@RequestBody JwtAuthCheckVo vo){
        return authService.JwtAuthCheck(vo);
    }

//    @PostMapping("/JwtTokenRenewal")
//    public RespBean JwtTokenRenewal(@RequestBody JwtAuthCheckVo vo){
//        return authService.JwtTokenRenewal(vo);
//    }

    @GetMapping("/testFeign")
    public RespBean testFeign(){
        return memberFeignService.testFeignUserAgent();
    }

}
